The invention is directed toward the field of command line execution of scripts, and more particularly to a technology for generating a complete command line needed to execute a script, and even more particularly to technology for prompting a user to supply values for undefined variables in a script and then for generating a complete command line needed to execute that script.
A script is a program or sequence of commands that is interpreted or carried out by another program. In contrast, a compiled program is a sequence of commands that has been converted to the machine code of a processor for direct execution by the processor. Generally, scripts are easier and faster to code than a program that is to be compiled.
Scripts are typically executed from a command line. The user types in the name of the script and any arguments that are to be passed to the script. Such arguments often represent undefined variables within the script. An undefined variable is one for which the value is supplied to the script at the time of execution, most typically in the form of an argument appended to the command line.
FIG. 1 is a schematic depiction of command line execution 100 according to the background art. Block 102 represents a total command line being manually generated and input by the user to a scripting-language interpreter 104. Again, the burden is upon the user to remember the undefined variables within a script, as well as the required format by which to submit values for the undefined variables as arguments appended to the command line.
Alternatively, the script can be written to prompt a user to supply all of the undefined variables. But this requires there to be dedicated user interface portions added to the script that greatly complicate and lengthen it. Moreover, such dedicated user interface portions are wasted on a sophisticated user of the script because he will know the undefined variables within the script and will remember what needs to be passed as an argument in the command line, as well as the formats of these arguments. And the dedicated user interface portions slow down execution of the script.
For the sophisticated user, the command line interface is a very flexible tool for executing a script. Also, by putting the burden of remembering and supplying undefined variables as well as other arguments upon the user, rather than as dedicated user-interface portions within the script, the scripts are easier to write, shorter and execute more quickly.
But for the unsophisticated user, command line execution is a source of frustration for some and quite possibly a total barrier for others. Typically, the unsophisticated user is not familiar with undefined variables used by a script. If for some reason the user is aware of these variables, very often the user is unaware of the format in which to supply values for these variables at the command line. As a result, the unsophisticated user must suffer through a series of trials and errors at forming the command line in order to arrive at success. And some of the unsophisticated users never form the command correctly.
The invention is, in part, a recognition of the problem that many unsophisticated users wish to use scripts that are intended for sophisticated users who are adept at command line execution.
The invention, in part, provides a method (and the corresponding software and apparatus) for generating a command line for a script. Such command line generation prompts the unsophisticated user to submit values for all of the undefined variables in the script and then produces the command line with all necessary values for variables being appended as arguments in the requisite form, as well as any other necessary arguments.
The invention, in part, also provides a method (and the associated software and apparatus) of command line execution of a script, the script including at least one undefined variable the value of which is intended to be supplied by a user as an argument in the command line at the time of executing the script. Such a method comprises: a) providing the script; b) finding instances in the script of the undefined variables for which the values are intended to be supplied by the user as the arguments in the command line; c) prompting the user to input a value for the at least one undefined variable, respectively; and d) generating a complete command line, the complete command line having arguments corresponding to values obtained by the step c).
The invention, in part, also provides a method (and the corresponding software and apparatus): of command line execution of a script, the script including at least one undefined variable the value of which is intended to be supplied by a user as an argument in the command line at the time of executing the script. Such a method comprises: a) providing the script; b) treating a first line of the script as a text string; c) searching the string for all substrings corresponding to the undefined variables for which the values are intended to be supplied by the user as the arguments in the command line; d) prompting the user to input a value for the corresponding at least one undefined variable, respectively; e) storing the at least one value received from the user in the step d); f) repeating the steps b)-e) for the remaining lines of the script; and g) generating a complete command line for the script that has arguments corresponding to the values stored in the step e).
The foregoing and other objectives of the present invention will become more apparent from the detailed description given hereinafter. However, it should be understood that the detailed description and specific examples, while indicating preferred embodiments of the invention, are given by way of illustration only, since various changes and modifications within the spirit and scope of the invention will become apparent to those skilled in the art from this detailed description.